package test4;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Author Jun jie Yi
 * 2022/5/6 10:37
 */
public class Demo4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        //起点
        for (int i = 0; i < a.length; i++) {
            int flag = i;
            for (int j = i; j < a.length - 1; j++) {
                if (a[j + 1] > a[j]) {

                }
            }
        }
        System.out.println(get(a));
    }

    class Solution {
        public int findLengthOfShortestSubarray(int[] arr) {
            int n = arr.length;
            int left = 0;
            while (left + 1 < n && arr[left] <= arr[left+1]) {
                left++;
            }
            // [0...left]有序
            if (left == n - 1) {
                return 0;
            }
            // [right...n-1]有序
            int right = n - 1;
            while (right > 0 && arr[right - 1] <= arr[right]) {
                right--;
            }

            // 完全删除一边[left+1, n-1], 或者[0...right - 1]
            int result = Math.min(n - left - 1, right);

            // 左边和右边各保留一部分
            int i = 0, j = right;

            while (i <= left && j <= n - 1) {
                if (arr[i] <= arr[j]) {
                    // [0...i] 和 [j...n-1] 有序, 删除 [i+1...j-1]
                    result = Math.min(result, j - i - 1);
                    i++;
                } else {
                    // 小的+1
                    j++;
                }
            }
            return result;
        }
    }

    public int findLengthOfShortestSubarray(int[] arr) {
        int n = arr.length;
        int left = 0;
        while (left + 1 < n && arr[left] <= arr[left+1]) {
            left++;
        }
        if (left == n - 1) {
            return 0;
        }
        int right = n - 1;
        while (right > 0 && arr[right - 1] <= arr[right]) {
            right--;
        }
        int result = Math.min(n - left - 1, right);
        int i = 0, j = right;
        while (i <= left && j <= n - 1) {
            if (arr[i] <= arr[j]) {
                result = Math.min(result, j - i - 1);
                i++;
            } else {
                j++;
            }
        }
        return result;
    }

    public static int get(int[] a) {
        int[] arr = new int[a.length];
        int r = 1;
        Arrays.fill(arr, 1);
        for (int i = 1; i < arr.length; i++) {
            int max = 1;
            for (int j = 0; j < i; j++) {
                if (a[i] > a[j]) {
                    if (max < arr[j] + 1) max = arr[j] + 1;
                }
            }
            arr[i] = max;
            if (r < max) {
                r = max;
            }
        }
        return r;
    }
}
